﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Stone
{
    public enum TipiFile {Directory, Generico, Php, Txt};

    public class FileFtp
    {
        public string path = "";
        public string nome = "";
        public string dir = "";
        public bool isDir = false;

        public FileFtp(string p, string n, string d, bool i)
        {
            path = p;
            nome = n;
            dir = d;
            isDir = i;
        }
    }

    public class FTP_file
    {
        public string nome = "";
        public FTP_file_attributi attributi = new FTP_file_attributi();

        public void determinaTipoFile()
        {
            if (nome.ToLower().EndsWith(".php"))
                attributi.tipo = TipiFile.Php;

            if (nome.ToLower().EndsWith(".txt"))
                attributi.tipo = TipiFile.Txt;
        }
    }

    public class FTP_file_attributi
    {        
        public TipiFile tipo = TipiFile.Generico;
        public string fullPath = "";
    }

    public class FtpServer
    {
        public string nome = "";
        public string url = "";
        public string username = "";
        public string password = "";
    }

    public class ElencoServer
    {
        public FtpServer [] items = new FtpServer[] { };
        public void Add(FtpServer nuovo)
        {
            FtpServer[] tmpArr = new FtpServer[items.Length + 1];
            items.CopyTo(tmpArr, 0);
            tmpArr.SetValue(nuovo, items.Length);
            items = tmpArr;
        }
        public FtpServer get(int i)
        {
            return items[i];
        }
        public void remove(FtpServer t)
        {
            FtpServer[] tmpArr = new FtpServer[items.Length - 1];
            int counter = 0;

            foreach (FtpServer tmp in items)
            {
                if (tmp != t)
                {
                    tmpArr[counter] = tmp;
                    counter++;
                }
            }

            items = tmpArr;
        }
    }
}

